package com.fottas.adware.portal.component;

import com.fottas.adware.portal.domain.QueueEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class CancelSmsSender {
    private static Logger LOGGER =LoggerFactory.getLogger(CancelSmsSender.class);
    @Autowired
    private AmqpTemplate amqpTemplate;

    /**
     * 发送消息
     * @param map 手机号+验证码
     */
    public void sendMessage(Map<String, String> map){
        //给延迟队列发送消息
        amqpTemplate.convertAndSend(QueueEnum.QUEUE_SMS_CANCEL.getExchange(), QueueEnum.QUEUE_SMS_CANCEL.getRouteKey(),map);
        LOGGER.info("send sms:{}",map);
    }
}
